package davion.study.summercloud.config;

import davion.study.summercloud.interceptor.LoginHandleInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: Davion
 * @date: 2020/6/16
 * @description:
 */
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandleInterceptor()).addPathPatterns("/**")
                .excludePathPatterns(
                        "/", "/testUser", "/login", "/callback", "/druid/**", "/file/**",
                        // 允许访问静态资源
                        "/css/**", "/img/**", "/js/**", "/plug-ins/**", "/u-admin.dist/**");
    }
}
